$(function () {
	$("#welcome_logo").hover(function () {
		$(this).animate({ backgroundColor: '#30A8F4' }, { speed: 1000, queue: false });
	}, function () {
		$(this).animate({ backgroundColor: '#F65314' }, { speed: 1000, queue: false });
	});

	////////////////////////////////////翻转效果/////////////////////////////////////
	var hasFilped1 = false;
	var inNavi1 = false;
	var hasFilped2 = false;
	var inNavi2 = false;
	$("#welcome_navi_exam").mouseover(function () {
		inNavi1 = true;
		if (hasFilped1 == false) {
			$(this).flippy({
				color_target: '#75AF1C',
				content: "Click Start!",
				direction: "RIGHT",
				duration: "500",
				onStart: function () {
					$('#exam_intro').slideDown(500);
					$("#welcome_test_type").attr("value","exam")
				},
				onFinish: function () {
					hasFilped1 = true;
					if (inNavi1 == true) {

					}
					else if (inNavi1 == false) {
						$('#welcome_navi_exam').flippy({
							color_target: '#75AF1C',
							content: 'Examination',
							direction: "LEFT",
							duration: "500",
							onStart: function () {
								$('#exam_intro').slideUp(500);
							},
							onFinish: function () {
								hasFilped1 = false;
							}
						});
					}
				}
			});
		}
	});
	$("#welcome_navi_exam").mouseout(function () {
		if (hasFilped1 == true) {
			$('#welcome_navi_exam').flippy({
				color_target: '#75AF1C',
				content: 'Examination',
				direction: "LEFT",
				duration: "500",
				onStart: function () {
					$('#exam_intro').slideUp(500);
				},
				onFinish: function () {
					hasFilped1 = false;
				}
			});
		}
		inNavi1 = false;
	});

	//////////////////////////////////////////////////////////////////////////
	$("#welcome_navi_simulate").mouseover(function () {
		inNavi2 = true;
		if (hasFilped2 == false) {
			$(this).flippy({
				color_target: '#279FEB',
				content: "Click Start!",
				direction: "RIGHT",
				duration: "500",
				onStart: function () {
					$('#practice_intro').slideDown(500);
					$("#welcome_test_type").attr("value","practice")
				},
				onFinish: function () {
					hasFilped2 = true;
					if (inNavi2 == true) {

					}
					else if (inNavi2 == false) {
						$('#welcome_navi_simulate').flippy({
							color_target: '#279FEB',
							content: 'Practice Test',
							direction: "LEFT",
							duration: "500",
							onStart: function () {
								$('#practice_intro').slideUp(500);
							},
							onFinish: function () {
								hasFilped2 = false;
							}
						});
					}
				}
			});
		}
	});
	$("#welcome_navi_simulate").mouseout(function () {
		if (hasFilped2 == true) {
			$('#welcome_navi_simulate').flippy({
				color_target: '#279FEB',
				content: 'Practice Test',
				direction: "LEFT",
				duration: "500",
				onStart: function () {
					$('#practice_intro').slideUp(500);
				},
				onFinish: function () {
					hasFilped2 = false;
				}
			});
		}
		inNavi2 = false;
	});
	//////////////////////////////////////////////////////////////////////////
	var hasFilped3 = false;
	var inNavi3 = false;

	$("#welcome_navi_free").mouseover(function () {
		inNavi3 = true;
		if (hasFilped3 == false) {
			$(this).flippy({
				color_target: '#FE8D00',
				content: "Click Start!",
				direction: "RIGHT",
				duration: "500",
				onStart: function () {
					$('#free_intro').slideDown(500);
					$("#welcome_test_type").attr("value","free")
				},
				onFinish: function () {
					hasFilped3 = true;
					if (inNavi3 == true) {

					}
					else if (inNavi3 == false) {
						$('#welcome_navi_free').flippy({
							color_target: '#FE8D00',
							content: 'Free Q&A',
							direction: "LEFT",
							duration: "500",
							onStart: function () {
								$('#free_intro').slideUp(500);
							},
							onFinish: function () {
								hasFilped3 = false;
							}
						});
					}
				}
			});
		}
	});
	$("#welcome_navi_free").mouseout(function () {
		if (hasFilped3 == true) {
			$('#welcome_navi_free').flippy({
				color_target: '#FE8D00',
				content: 'Free Q&A',
				direction: "LEFT",
				duration: "500",
				onStart: function () {
					$('#free_intro').slideUp(500);
				},
				onFinish: function () {
					hasFilped3 = false;
				}
			});
		}
		inNavi3 = false;
	});
	//////////////////////////////////////////////////////////////////////////
	$('#welcome_navi_exam').click(function () {
		//window.location.href = "exam.htm";
		$("#welcome_form").submit();
	});
	$('#welcome_navi_simulate').click(function () {
		//window.location.href = "simulate.htm";
		$("#welcome_form").submit();
	});
	$('#welcome_navi_free').click(function () {
		//window.location.href = "freeAnswer.htm";
		$("#welcome_form").submit();
	});
});